<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<meta name="format-detection" content="telephone=no" />
<meta name="apple-touch-fullscreen" content="YES" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="MobileOptimized" content="320" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<title>上品生活</title>
<link href="__PUBLIC__/Catalog/css/css.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__PUBLIC__/Catalog/jsn/jquery1.42.min.js"></script>
</head>

<body>
<div class="top"><a href="javascript:history.back();"><img src="__PUBLIC__/Catalog/nimages/tb.png"></a>
    <p>手机绑定</p>
</div>

<div class="S-reg login_reg">
   <form action="<?php echo U('Membership/clocktel');?>" id="clocktel" method="post">
    <div class="S-form_box">
       <div class="height25"></div>
       <p class="tPhone"><span class="m1">已绑定手机：</span><span class="m2"><?php echo ($oldtel); ?></span></p>
       <ul>
         <li class="phone"><input type="text" id="tel" name="tel" placeholder="请输入您的手机号码" class="text" /><a  id="yzbutton" class="xym">获取验证码</a></li>
         <li class="xym">
	         <input type="text" name="yanzheng" id="yanzheng" placeholder="请输入您的手机验证码" class="text" />
	         <input type="hidden" name="yanzhengagain" id="yanzhengagain" value="" />
         </li>
       </ul>
       <input type="button" class="sub" id="tijiao" value="确认绑定" />
    </div>
   </form>
</div>

<!-- 
<link href="__PUBLIC__/Catalog/css/reg.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="main">
   <div class="title">
         <div class="title1">
             <a href="<?php echo ($back); ?>" id="back"> < </a>绑定号码
         </div>
   </div>
   <div class="reg">
        <div class="reg2">
        	<form action="<?php echo U('Membership/clocktel');?>" id="clocktel" method="post">
        		<ul>
	               <li><span class="sp_p1">手机号</span> <span class="sp_p2"><input type="tel" id="tel" name="tel" value="<?php echo ($oldtel); ?>" placeholder="请输入需要绑定的手机号码" /></span></li>
	               <li>
	                   <span class="sp_y1">验证码</span> 
	                   <span class="sp_y2">
	                   <input type="text" name="yanzheng" id="yanzheng" maxlength="6"  />
	                   <input type="hidden" name="yanzhengagain" id="yanzhengagain" value="" />
	                   </span>
	                   <span class="sp_y3"  id="yzbutton">获取验证码</span>
	               </li>
	               <li id="sub"><input type="button" id="tijiao"  value="确定绑定" /></li>
	            </ul>
        	</form>
            
        </div>
   </div>
</div> -->
<script>
$(function(){
    if('<?php echo ($msg); ?>'!='0'){
        alert('<?php echo ($msg); ?>');
    }
});

$('#yzbutton').bind("click",function(){
	var tel = $('#tel').val();
	var isMobile=/^(?:13\d|15\d|18\d)\d{5}(\d{3}|\*{3})$/;
	
	if(isMobile.test(tel)){
    	 $.ajax({
    			type:"post",
    			url:"<?php echo U('Membership/sendyzm');?>",
    			datatype:'json',
    			data:{tel:tel},
    			success:function(result){
    				datacontent =window.JSON.parse(result);
    				if(datacontent.flag==1){
    					alert(datacontent.msg);
    				}else {
    					$('#yanzhengagain').val(datacontent.yanzhengma);
    					alert(datacontent.msg+datacontent.yanzhengma);
    				}
    				
    			},
    			error: function(XMLHttpRequest, textStatus, errorThrown) {
    				alert(XMLHttpRequest.status);
    				alert(XMLHttpRequest.readyState);
    				alert(textStatus);
    			},
    		});
     } else {
    	 alert("请正确填写电话号码，例如:13415764179"); 
     }
	
});

$('#tijiao').bind("click",function(){
	var yanzheng = $('#yanzheng').val();
	var yanzhengagain = $('#yanzhengagain').val();
	if(yanzheng==''){
		alert('验证码不能为空！');
		return false;
	}else{
		if(yanzheng!=yanzhengagain){
			alert('验证码输入错误！');
		}else{
			$('#clocktel').submit();
		}
	}
	
	
});
</script>
 <div id="master_foot">
  	<a href="<?php echo U('Index/index');?>" class="cover"><img src="__PUBLIC__/Catalog/nimages/bottom_10.png"><span>首页</span></a>
  	<a href="<?php echo U('Products/index');?>"><img src="__PUBLIC__/Catalog/nimages/bottom_12.png"><span>商品</span></a>
  	<a href="<?php echo U('Mproducts/publish');?>"><img src="__PUBLIC__/Catalog/nimages/bottom_03.png"><span>发布</span></a>
  	<a href="<?php echo U('Membership/leaveword');?>" class="xx"><i><?php echo ($count); ?></i><img src="__PUBLIC__/Catalog/nimages/bottom_05.png"><span>信息</span></a>
  	<a href="<?php echo U('Membership/index');?>"><img src="__PUBLIC__/Catalog/nimages/bottom_07.png"><span>我的</span></a>
  </div>
</body>
</html>